package com.vne.skyemart.dao.impl;

import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import com.vne.skyemart.dao.UserDao;
import com.vne.skyemart.model.ADUser;

@Repository("userDao")
public class UserDaoImpl extends AbstractHibernateDAO<ADUser, Integer> implements UserDao{
	public UserDaoImpl() {
		super(ADUser.class);
	}

	@Override
	public ADUser findUserByUsername(String username, String isActive,
			String isDelete) {
		Criterion userName = Restrictions.eq("username", username);
		Criterion active = Restrictions.eq("isActived", isActive);
		Criterion delete = Restrictions.eq("isDeleted", isDelete);
		return findObjectByCriteria(userName, active, delete);
	}
}
